<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>
 <%@page import="java.text.*"%> 
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>考勤记录</title>
<link href="<c:url value='/insdep/reset.min.css' />" rel="stylesheet" type="text/css">
<link href="<c:url value='/insdep/easyui_full.css'/>" rel="stylesheet" type="text/css">
<link href="<c:url value='/insdep/icon.css'/>" rel="stylesheet" type="text/css">
<script type="text/javascript" src="<c:url value='/insdep/jquery-1.11.3.min.js'/>"></script>
<script type="text/javascript" src="<c:url value='/insdep/jquery.easyui-1.5.2.min.js'/>"></script>
<script type="text/javascript" src="<c:url value='/insdep/insdep-extend.min.js'/>"></script>
<link rel="stylesheet" type="text/css" href="<c:url value='/insdep/iconfont/iconfont.css' />">
<link href="<c:url value='/css/wsf-button.css'/>" rel="stylesheet" type="text/css">
</head>
<body>
	<script type="text/javascript">
		$(function(){
			/**
			 *时间段查询
			 */
		 	$('#check_work_query_emp_oneone').linkbutton({
						onClick:function(){
							var starttime = $("#check_work_start_date_oneone").val();
							var endtime = $("#check_work_end_date_oneone").val();
							$.post("to_findOneAllCheckInfo",{starttime:starttime,endtime:endtime,page:1,rows:10},function(data){
	
								$('#loanlog_Info_table_oneone').datagrid('loadData',data);
							});
						}
				});
			
			$("window").load(function(){
				//限制开始时间不能选择大于当前日期的时间
		 		var startcalendar = $('#check_work_start_date_oneone').datebox('calendar');
				startcalendar.calendar({
					validator: function(date){
						//当前时间
						var current = new Date().getTime();
						//结束时间
				    	var enddate = $('#check_work_end_date_oneone').val();
						if (date.getTime()>current) { 
							return false;
						} else {                 
							return true;                                
						}
						
						
					}
				});
				//限制结束时间不能选择大于当前日期的时间
				var endcalendar = $('#check_work_end_date_oneone').datebox('calendar');
				endcalendar.calendar({
					validator: function(date){
						var current = new Date().getTime();
				    	var startdate = $('#check_work_start_date_oneone').val();
				    	
						if (date.getTime()>current) { 
							//alert('选择的时间不能大于当前时间！');
							return false;
						} else {                 
							return true;                                
						}
				    	 
					}
				});
			})
		});
		
		/**
		 *毫秒转日期
		 */
		function formatter_date_oneone(val, row, index){
			var d, s = "";
			var x = new Array("星期日", "星期一", "星期二", "星期三",
					"星期四", "星期五", "星期六");
			d = new Date(val);
			s += d.getFullYear() + "-" + (d.getMonth() + 1)
					+ "-" + d.getDate()+" ";
			return s += x[d.getDay()];
		}
		
		/**
		 *改变字体颜色
		 */
		function formatter_font_color_oneone(val, row, index){
			return "<span style='color:red'>"+val+"</span>";
		}
	</script>

	<div class="easyui-layout " data-options="fit:true">
		<div style="border: 0px solid red" data-options="region:'center',title:'我的考勤记录'">
		        <table id="loanlog_Info_table_oneone" style="width:100%;height: 100%" class="easyui-datagrid" 
				data-options="
					fit:true,
					url:'to_findOneAllCheckInfo',
					rownumbers: true,
					toolbar: '#check_work_query_oneone',
					nowrap:false, 
					autoRowHeight:false,
					pagination:true,
					pageSize: 10,
					pageList:[10,20,30,40]">
					<thead>
						<tr>
							<th data-options="field:'attendanceId', align:'center',hidden:true">考勤编号</th>
							<th style="width:20%;" data-options="field:'attendanceDate', align:'center', formatter:formatter_date_oneone">考勤日期</th>
							<th style="width:15%;" data-options="field:'attparamLate', align:'center',formatter:formatter_font_color_oneone">上班时间</th>
							<th style="width:10%;" data-options="field:'attendanceOnworktime', align:'center'">实际上班时间</th>
							<th style="width:15%;" data-options="field:'attparamLeaveearly', align:'center',formatter:formatter_font_color_oneone">下班时间</th>
							<th style="width:10%;" data-options="field:'attendanceOffworktime', align:'center'">实际下班时间</th>
							<th data-options="field:'empId', align:'center',hidden:true">员工编号</th>
							<th data-options="field:'empName', align:'center',hidden:true">员工名字</th>
							<th data-options="field:'attypeId', align:'center',hidden:true">考勤类型编号</th>
							<th style="width:31.5%;" data-options="field:'attypeName', align:'center'">考勤类型名称</th>
						</tr>
					</thead>
			</table>
   		</div>
   		
   		 <div id="check_work_query_oneone">
	    	时间：<input  id="check_work_start_date_oneone"  type= "text" class= "easyui-datebox"> <span>--</span> 
	    	<input  id="check_work_end_date_oneone"  type= "text" class= "easyui-datebox"> 
    		<a id="check_work_query_emp_oneone" class="easyui-linkbutton button-line-blue"><i class="iconfont icon-roundcheck"></i>查询</a>
	    </div> 
	</div>	
</body>
</html>